#pragma once

#define WIN32_MEAN_AND_LEAN
#include <Windows.h>

#include <vector>
#include <string>
using namespace std;

#include "Math.h"

class CBaseObject;


class CFrame
{
public:
	CFrame(void);
	~CFrame(void);

	void UpdateFrame( CBaseObject* pOwner );
	void RenderFrame( CBaseObject* pOwner );

	bool CheckDefenseCollision( RECT* rAttackRect );
	bool CheckAttackCollision( RECT* rDefenseRect );
	bool CheckFrameCollision( CFrame* pFrame );

	/* Accessors */
	tVector2D	GetAnchorPoint( void ) const				{	return m_tAnchorPoint;			}
	string		GetFrameTrigger( void ) const				{	return m_szFrameTrigger;		}
	RECT		GetBaseRect( void ) const					{	return m_rBaseRect;				}
	int			GetFrameWidth( void ) const					{	return m_nFrameWidth;			}
	int			GetFrameHeight( void ) const				{	return m_nFrameHeight;			}
	float		GetDuration( void ) const					{	return m_fDuration;				}
	float		GetCurrTime( void ) const					{	return m_fCurrTime;				}

	/* Mutators */
	void		SetAnchorPoint( float fX, float fY );
	void		SetAnchorPoint( tVector2D tAnchorPoint )	{	m_tAnchorPoint = tAnchorPoint;	}
	void		SetFrameTrigger( const char * szTrigger )	{	m_szFrameTrigger = szTrigger;	}
	void		SetFrameWidth( int nWidth )					{	m_nFrameWidth = nWidth;			}
	void		SetFrameHeight( int	nHeight )				{	m_nFrameHeight = nHeight;		}
	
	/* Collision RECT functions */
	void		AddAttackRect( RECT rAttackRect );
	void		ClearAttackRects( void );
	void		AddDefenseRect( RECT rDefenseRect );
	void		ClearDefenseRects( void );
	void		SetBaseRect( RECT rBaseRect );

private:
	RECT			m_rFrameRect;
	vector< RECT >	m_AttackRects;
	vector< RECT >	m_DefenseRects;
	RECT			m_rBaseRect;
	tVector2D		m_tAnchorPoint;

	int				m_nImageID;
	int				m_nFrameWidth;
	int				m_nFrameHeight;

	string			m_szFrameTrigger;

	float			m_fDuration;
	float			m_fCurrTime;

	bool			m_bCurrFrame;
};

